package org.come.MountShouHu;

import com.tool.btn.MountShouhuBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import org.come.Frame.MsgJframe;
import org.come.bean.LoginResult;
import org.come.entity.Goodstable;
import org.come.until.FormsManagement;
import org.come.until.UserMessUntil;
import org.come.until.Util;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

import static com.tool.btn.MountShouhuBtn.getGoodType;


public class RandFJpanel extends JPanel {
public ImageIcon ico=new ImageIcon("inkImg/Client/守护石附灵背景.png");
public ImageIcon ico1=new ImageIcon("inkImg/Client/守护石融炼背景.png");
public ImageIcon ico2;
public ImageIcon IamelingqiaoL=new ImageIcon("inkImg/Client/灵窍_点亮.png");
public ImageIcon Iamelingqiao=new ImageIcon("inkImg/Client/灵窍_未点亮.png");
public ImageIcon ditu=new ImageIcon("inkImg/Client/12862-1.png");
public ImageIcon jindutiao=new ImageIcon("inkImg/Client/12861-1.png");
public int type=1;
public MountShouhuBtn xuanxiangka1;
public MountShouhuBtn xuanxiangka2;
public MountShouhuBtn kaishifuling;
public MountShouhuBtn kaishironglian;
public MountShouhuBtn FST;
public MountShouhuBtn FLT;
public MountShouhuBtn RST1;
public MountShouhuBtn RST2;
public MountShouhuBtn img1;
public MountShouhuBtn img2;
public MountShouhuBtn img3;
public MountShouhuBtn img4;
public Goodstable FL=null;
public Goodstable RL1=null;
public Goodstable RL2=null;
public JLabel panel1=new JLabel();
public JLabel panel2=new JLabel();
public JLabel panel3=new JLabel();
public JLabel panel4=new JLabel();
    public RandFJpanel(){
        this.setPreferredSize(new Dimension(740, 516));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);

        try {
            String imagePath = "inkImg/Client/灵元晶.png";  // Replace with the actual path to your image
            File imageFile = new File(imagePath);
            BufferedImage originalImage = ImageIO.read(imageFile);
            int maxSize = Math.max(originalImage.getWidth(), originalImage.getHeight());
            int scaledWidth = originalImage.getWidth() * 50 / maxSize;  // Adjust 50 to your desired size
            int scaledHeight = originalImage.getHeight() * 50 / maxSize; // Adjust 50 to your desired size
            Image scaledImage = originalImage.getScaledInstance(scaledWidth, scaledHeight, Image.SCALE_SMOOTH);
            ico2=new ImageIcon(scaledImage);
        } catch (IOException e) {
            e.printStackTrace();
        }
        xuanxiangka1=new MountShouhuBtn("inkImg/Client/选中按钮.png",1,8,"附灵",UIUtils.Black,UIUtils.TEXT_HY19,this);
        xuanxiangka1.setBounds(70,25,100,33);
        this.add(xuanxiangka1);
        xuanxiangka2=new MountShouhuBtn("inkImg/Client/未选中按钮.png",1,9,"熔炼",UIUtils.Black,UIUtils.TEXT_HY19,this);
        xuanxiangka2.setBounds(170,25,100,33);
        this.add(xuanxiangka2);
        kaishifuling=new MountShouhuBtn("inkImg/Client/92X26按钮.png",1,15,"开始附灵",UIUtils.Black,UIUtils.TEXT_HY16,this);
        kaishifuling.setBounds(280+50,455,92,26);
        this.add(kaishifuling);
        kaishironglian=new MountShouhuBtn("inkImg/Client/92X26按钮.png",1,16,"开始熔炼",UIUtils.Black,UIUtils.TEXT_HY16,this);
        kaishironglian.setBounds(580,455,92,26);
        this.add(kaishironglian);
        FST=new MountShouhuBtn("inkImg/Client/加号.png",1,17,this);
        FST.setBounds(130,185,17,17);
        this.add(FST);
        FLT=new MountShouhuBtn("inkImg/Client/加号.png",1,18,this);
        FLT.setVisible(false);
        FLT.setBounds(100,150,17,17);
        this.add(FLT);
        RST1=new MountShouhuBtn("inkImg/Client/加号.png",1,19,this);
        RST1.setBounds(135,95,17,17);
        this.add(RST1);
        RST2=new MountShouhuBtn("inkImg/Client/加号.png",1,20,this);
        RST2.setBounds(485,95,17,17);
        this.add(RST2);
        img1=new MountShouhuBtn("inkImg/Client/守护石.png",1,21,this);
        img1.setBounds(115,173,45,45);
        img1.addMouseListener(new ShouhuPackGoodsMouslisten(10,this));
        img1.setVisible(false);
        this.add(img1);
        img2=new MountShouhuBtn("inkImg/Client/守护石.png",1,22,this);
        img2.setBounds(FST.getX(),FST.getY(),45,45);
      //  this.add(img2);
        img3=new MountShouhuBtn("inkImg/Client/守护石.png",1,23,this);
        img3.setBounds(120,86,45,45);
        img3.addMouseListener(new ShouhuPackGoodsMouslisten(11,this));
        img3.setVisible(false);
        this.add(img3);
        img4=new MountShouhuBtn("inkImg/Client/守护石.png",1,24,this);
        img4.setBounds(470,86,45,45);
        img4.addMouseListener(new ShouhuPackGoodsMouslisten(12,this));
        img4.setVisible(false);
        this.add(img4);
      //  panel1.setBounds(440,315-18,100,20);
        panel1.setOpaque(false);
        panel1.setForeground(Color.GREEN);
        panel1.setFont(UIUtils.TEXT_NAME_FONT);
        panel1.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                super.mouseEntered(e);
                if (panel1.getText()!=null)
                MsgJframe.getJframe().getJapnel().skillmsg(Objects.requireNonNull(UserMessUntil.getskill1(panel1.getText().split(":")[0])));
            }
    
            @Override
            public void mouseExited(MouseEvent e) {
                super.mouseExited(e);
                FormsManagement.HideForm(46);
            }
        });
        this.add(panel1);
       // panel2.setBounds(440,315-18+30,100,20);
        panel2.setOpaque(false);
        panel2.setForeground(Color.GREEN);
        panel2.setFont(UIUtils.TEXT_NAME_FONT);
        panel2.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                super.mouseEntered(e);
                if (panel2.getText()!=null)
                    MsgJframe.getJframe().getJapnel().skillmsg((UserMessUntil.getskill1(panel2.getText().split(":")[0])));
            }
        
            @Override
            public void mouseExited(MouseEvent e) {
                super.mouseExited(e);
                FormsManagement.HideForm(46);
            }
        });
        this.add(panel2);
      //  panel3.setBounds(440,315-18+30,100,20);
        panel3.setOpaque(false);
        panel3.setForeground(Color.GREEN);
        panel3.setFont(UIUtils.TEXT_NAME_FONT);
        panel3.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                super.mouseEntered(e);
                if (panel3.getText()!=null)
                    MsgJframe.getJframe().getJapnel().skillmsg(Objects.requireNonNull(UserMessUntil.getskill1(panel3.getText().split(":")[0])));
            }
        
            @Override
            public void mouseExited(MouseEvent e) {
                super.mouseExited(e);
                FormsManagement.HideForm(46);
            }
        });
        this.add(panel3);
        panel4.setOpaque(false);
        panel4.setForeground(Color.GREEN);
        panel4.setFont(UIUtils.TEXT_NAME_FONT);
        panel4.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                super.mouseEntered(e);
                if (panel4.getText()!=null)
                    MsgJframe.getJframe().getJapnel().skillmsg(Objects.requireNonNull(UserMessUntil.getskill1(panel4.getText().split(":")[0])));
            }
        
            @Override
            public void mouseExited(MouseEvent e) {
                super.mouseExited(e);
                FormsManagement.HideForm(46);
            }
        });
        this.add(panel4);


    }
public int num=0;
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        final LoginResult login = RoleData.getRoleData().getLoginResult();
        panel1.setVisible(false);
        panel2.setVisible(false);
        panel3.setVisible(false);
        panel4.setVisible(false);
        if (getType()==1){
            g.drawImage(ico.getImage(),0,0,740,516,null);
            Util.drawPrice(g, login.getGold(), 195, 300);
            Util.drawPrice(g, new BigDecimal(500000), 195, 270);
            if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1()!=-1){
                  g.drawImage(ico2.getImage(),275,170,ico2.getIconWidth()-2,ico2.getIconHeight()-2,null);
                  FST.setVisible(false);
                Goodstable ltrGoods = getGoodType(2258);
                int num = ltrGoods == null ? 0 : ltrGoods.getUsetime();
                if (num>0){
                    img1.setVisible(true);
                    g.setColor(Color.white);
                    g.drawString(num+"",277,182);
                }else  img1.setVisible(true);
                
                  
            }else {
                img1.setVisible(false);
            }
            pain(g);
        } else {
            g.drawImage(ico1.getImage(),0,0,740,516,null);
            Util.drawPrice(g, login.getGold(), 435, 458);
            Util.drawPrice(g, new BigDecimal(1000000), 180, 458);
            g.setColor(Color.black);
            g.drawString("50",180,490);
           g.drawString(RoleData.getRoleData().getLoginResult().getShouhu()+"",435,490);
            if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1()!=-1){
              img3.setVisible(true);
              RST1.setVisible(false);
            }else {
                img3.setVisible(false);
                RST1.setVisible(true);
            }
            if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong2()!=-1){
                img4.setVisible(true);
                RST2.setVisible(false);
            }else {
                img4.setVisible(false);
                RST2.setVisible(true);
            }
            pain1(g);
        }
   
    }
public void pain(Graphics g){
    super.paintComponent(g);
    if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1()==-1)return;
    if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().size()==0)return;
    int  l=ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1();
    if (l>=0)
    FL= ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().get(l);
    if (FL!=null){
        if (FL.getValue()!=null&&!FL.getValue().equals("")){
            String[] mes=FL.getValue().split("\\|");
            g.setColor(Color.WHITE);
            for (int i=0;i<7;i++){
                if (i==5){
                    if (mes.length>6&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),410,290,32,35,null);
                        panel1.setBounds(440,315-18,200,20);
                        panel1.setVisible(true);
                        panel1.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                      
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),410,290,32,35,null);
                        g.drawString("灵窍无灵气",440,315);
                    }
                   
                }else if (i==6){
                    if (mes.length>7&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),410,320,32,35,null);
                        //g.drawString(mes[i+1].split("=")[0],440,345);
                        panel2.setBounds(440,315-18+30,200,20);
                        panel2.setVisible(true);
                        panel2.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),410,320,32,35,null);
                        g.drawString("灵窍无灵气",440,345);
                    }
                  
                }else  {
                    if (mes.length>i+1&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),410,130+i*30,32,35,null);
                        g.drawString(mes[i+1].split("=")[0],440,130+i*30+25);
                        g.drawImage(ditu.getImage(),580,130+i*30+10,74,20,null);
                        g.drawImage(jindutiao.getImage(),581,130+i*30+10, (int) (72*bili(mes[i+1].split("=")[0],Double.parseDouble(mes[i+1].split("=")[1]))),17,null);
                        g.drawString(shuzhi(mes[i+1].split("=")[1],mes[i+1].split("=")[0]),600,130+i*30+23);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),410,130+i*30,32,35,null);
                        g.drawString("灵窍无灵气",440,130+i*30+25);
                    }
                   
                }
            }
        }else {
            g.setColor(new Color(0xF3BB9A7E, true));
            for (int i=0;i<7;i++){
                if (i==5){
                    g.drawImage(Iamelingqiao.getImage(),410,290,32,35,null);
                    g.drawString("灵窍无灵气",440,315);
                }else if (i==6){
                    g.drawImage(Iamelingqiao.getImage(),410,320,32,35,null);
                    g.drawString("灵窍无灵气",440,345);
                }else  {
                    g.drawImage(Iamelingqiao.getImage(),410,130+i*30,32,35,null);
                    g.drawString("灵窍无灵气",440,130+i*30+25);
                }
            }
        }
    }else {
        g.setColor(new Color(0xF3BB9A7E, true));
        for (int i=0;i<7;i++){
            if (i==5){
                g.drawImage(Iamelingqiao.getImage(),410,290,32,35,null);
                g.drawString("灵窍无灵气",440,315);
            }else if (i==6){
                g.drawImage(Iamelingqiao.getImage(),410,320,32,35,null);
                g.drawString("灵窍无灵气",440,345);
            }else  {
                g.drawImage(Iamelingqiao.getImage(),410,130+i*30,32,35,null);
                g.drawString("灵窍无灵气",440,130+i*30+25);
            }
        }
    }
  
}
public void pain1(Graphics g){
    super.paintComponent(g);
    if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1()==-1)return;
    int  l=ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1();
    if (l>=0&&l<ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().size())
        RL1= ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().get(l);
    int  k=ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong2();

    if (k>=0&&k<ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().size())
        RL2= ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().get(k);
    if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong2()==-1)RL2=null;
    if (RL1!=null){
        int y=-30;
        if (RL1.getValue()!=null&&!RL1.getValue().equals("")){
            g.setColor(Color.white);
            String[] mes =RL1.getValue().split("\\|");
            g.drawString(mes[0].split("=")[1]+"级",265,128);
            for (int i=0;i<7;i++){
                if (i==5){
                    if (mes.length>6&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),70,290-y,32,35,null);
                       // g.drawString(mes[i+1].split("=")[0],100,315-y);
                        panel1.setBounds(100,315-18+30,200,20);
                        panel1.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                        panel1.setVisible(true);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70,290-y,32,35,null);
                        g.drawString("灵窍无灵气",100,315-y);
                        // g.drawImage(ditu.getImage(),580,290+10,74,20,null);
                        // g.drawImage(jindutiao.getImage(),581,290+10,72,17,null);
                    }
                  /*  g.drawImage(ditu.getImage(),615-350,290+10+30,74,20,null);
                    g.drawImage(jindutiao.getImage(),615-350,290+10+30,72,17,null);*/
                }else if (i==6){
                    if (mes.length>7&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),70,320-y,32,35,null);
                      //  g.drawString(mes[i+1].split("=")[0],100,345-y);
                        panel2.setBounds(100,315-18+30+30,200,20);
                        panel2.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                        panel2.setVisible(true);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70,320-y,32,35,null);
                        g.drawString("灵窍无灵气",100,345-y);
                    }
                   // g.drawImage(ditu.getImage(),615-350,320+10+30,74,20,null);
                   // g.drawImage(jindutiao.getImage(),616-350,320+10+30,72,17,null);
                }else  {
                    if (mes.length>i+1&&!mes[i+1].equals("0")){
                        g.drawImage(IamelingqiaoL.getImage(),70,130+i*30-y,32,35,null);
                        g.drawString(mes[i+1].split("=")[0],100,130+i*30+25-y);
                        g.drawImage(ditu.getImage(),615-350,130+i*30+10-y,74,20,null);
                        g.drawImage(jindutiao.getImage(),615-350,130+i*30+10-y, (int) (72*bili(mes[i+1].split("=")[0],Double.parseDouble(mes[i+1].split("=")[1]))),17,null);
                        g.drawString(shuzhi(mes[i+1].split("=")[1],mes[i+1].split("=")[0]),600-320,130+i*30+23-y);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70,130+i*30-y,32,35,null);
                        g.drawString("灵窍无灵气",100,130+i*30+25-y);
                    }
                  //  g.drawImage(ditu.getImage(),615-350,130+i*30+10+30,74,20,null);
                  //  g.drawImage(jindutiao.getImage(),615-350,130+i*30+10+30,72,17,null);
                }
            }
        }else {
            g.setColor(new Color(0xF3BB9A7E, true));
            for (int i=0;i<7;i++){
                if (i==5){
                    
                    g.drawImage(Iamelingqiao.getImage(),70,290-y,32,35,null);
                    g.drawString("灵窍无灵气",100,315-y);
                }else if (i==6){
                    g.drawImage(Iamelingqiao.getImage(),70,320-y,32,35,null);
                    g.drawString("灵窍无灵气",100,345-y);
                }else  {
                    g.drawImage(Iamelingqiao.getImage(),70,130+i*30-y,32,35,null);
                    g.drawString("灵窍无灵气",100,130+i*30+25-y);
                }
            }
            
        }
    }
    if (RL2!=null){
        int y=-30;
        int x=360;
        if (RL2.getValue()!=null&&!RL2.getValue().equals("")){
            g.setColor(Color.white);
            String[] mes =RL2.getValue().split("\\|");
            g.drawString(mes[0].split("=")[1]+"级",610,128);
            for (int i=0;i<7;i++){
                if (i==5){
                    if (mes.length>6&&!mes[i+1].equals("0")){
                     //   g.drawImage(ditu.getImage(),615,290+10+30,74,20,null);
                       // g.drawImage(jindutiao.getImage(),616,290+10+30,72,17,null);
                        g.drawImage(IamelingqiaoL.getImage(),70+x,290-y,32,35,null);
                       // g.drawString(mes[i+1].split("=")[0],100+x,315-y);
                        panel3.setBounds(460,315-18+30,200,20);
                        panel3.setVisible(true);
                        panel3.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                       // g.drawString("灵窍无灵气",100+x,315-y);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70+x,290-y,32,35,null);
                        g.drawString("灵窍无灵气",100+x,315-y);
                    }
                   
                }else if (i==6){
                    if (mes.length>7&&!mes[i+1].equals("0")){
                      //  g.drawImage(ditu.getImage(),615,320+10+30,74,20,null);
                       // g.drawImage(jindutiao.getImage(),616,320+10+30,72,17,null);
                        g.drawImage(IamelingqiaoL.getImage(),70+x,320-y,32,35,null);
                     //   g.drawString(mes[i+1].split("=")[0],100+x,345-y);
                        panel4.setBounds(460,315-18+30+30,200,20);
                        panel4.setVisible(true);
                        panel4.setText(UserMessUntil.getSkillId(mes[i+1].split("=")[0]).getSkillname()+":"+mes[i+1].split("=")[1]+"级");
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70+x,320-y,32,35,null);
                        g.drawString("灵窍无灵气",100+x,345-y);
                    }
                   
                }else  {
                    if (mes.length>i+1&&!mes[i+1].equals("0")){
                        g.drawImage(ditu.getImage(),615,130+i*30+10+30,74,20,null);
                        g.drawImage(jindutiao.getImage(),615,130+i*30+10+30,(int) (72*bili(mes[i+1].split("=")[0],Double.parseDouble(mes[i+1].split("=")[1]))),17,null);
                        g.drawImage(IamelingqiaoL.getImage(),70+x,130+i*30-y,32,35,null);
                      //  g.drawString("灵窍无灵气",100+x,130+i*30+25-y);
                        g.drawString(mes[i+1].split("=")[0],100+x,130+i*30+25-y);
                        g.drawString(shuzhi(mes[i+1].split("=")[1],mes[i+1].split("=")[0]),630,130+i*30+23-y);
                    }else {
                        g.setColor(new Color(0xF3BB9A7E, true));
                        g.drawImage(Iamelingqiao.getImage(),70+x,130+i*30-y,32,35,null);
                        g.drawString("灵窍无灵气",100+x,130+i*30+25-y);
                    }
                   
                }
            }
        }else {
            g.setColor(new Color(0xF3BB9A7E, true));
            for (int i=0;i<7;i++){
                if (i==5){
                    g.drawImage(Iamelingqiao.getImage(),70+x,290-y,32,35,null);
                    g.drawString("灵窍无灵气",100+x,315-y);
                }else if (i==6){
                    g.drawImage(Iamelingqiao.getImage(),70+x,320-y,32,35,null);
                    g.drawString("灵窍无灵气",100+x,345-y);
                }else  {
                    g.drawImage(Iamelingqiao.getImage(),70+x,130+i*30-y,32,35,null);
                    g.drawString("灵窍无灵气",100+x,130+i*30+25-y);
                }
            }
        }
    }
   
}
public double bili(String mes,double value){
    List<MountShouhu>mountShouhus= UserMessUntil.getAllMountShouhu().getAllmountshouhu();
    for (int i=0;i<=mountShouhus.size()-1;i++){
        if (mountShouhus.get(i).type.equals(mes)){
            return  value/mountShouhus.get(i).value;
        }
    }
        return  0;
}
public String shuzhi (String v1,String v){
    if (v.contains("速度")||v.contains("攻击"))
        return v1;
    if (Double.parseDouble(v1)<100){
        return v1+"%";
    }
    return v1;
}
    public int getType() {
        if (type==1){
            kaishifuling.setVisible(true);
            kaishironglian.setVisible(false);
            FST.setVisible(true);
           RST1.setVisible(false);
            RST2.setVisible(false);
        }else if (type==2){
            kaishifuling.setVisible(false);
            kaishironglian.setVisible(true);
            FST.setVisible(false);
            RST1.setVisible(true);
            RST2.setVisible(true);

        }else {
            kaishifuling.setVisible(false);
            kaishironglian.setVisible(false);
          
        }

        return type;
    }

    public void setType(int type) {
        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong1(-1);
        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong2(-1);
       FL=null;
       RL1=null;
       RL2=null;
       img1.setVisible(false);
       img3.setVisible(false);
       img4.setVisible(false);
        if (type==1){
        

        }else {
        
        }
        this.type = type;
    }

    public MountShouhuBtn getXuanxiangka1() {
        return xuanxiangka1;
    }

    public void setXuanxiangka1(MountShouhuBtn xuanxiangka1) {
        this.xuanxiangka1 = xuanxiangka1;
    }

    public MountShouhuBtn getXuanxiangka2() {
        return xuanxiangka2;
    }

    public void setXuanxiangka2(MountShouhuBtn xuanxiangka2) {
        this.xuanxiangka2 = xuanxiangka2;
    }

   
}
